﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Backend/Backend.Master" Inherits="System.Web.Mvc.ViewPage<IntroduceCompany.ArticleListView>" %>
<%@Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor"%>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ArticleEdit
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="<%= Url.Content("../../../Content/Backend/js/ckeditor/ckeditor.js")%>"></script>

<!-- Begin one column tab content window -->
    <div class="onecolumn">
        <div class="header">
            <span>Thêm ngôn ngữ hoặc chỉnh sửa bài viết</span>
            <div class="switchbutton">
            <% if (Model.ArticleVisible)
                {%>
                <a href="<%= Url.Action("Frontend_ArticleDetails2", "Article", new  { articleID = Model.ArticleID, languageID = Model.LanguageID, articleTypeID = Model.ArticleTypeID })%>" target="_blank" class="button">Xem nhanh</a>
              <%} %>
                <a href="<%= Url.Action("ArticleCreate", "Article") %>" class="button">Thêm mới</a>
                <a href="<%= Url.Action("ArticleList", "Article") %>" class="button">Danh sách</a>
            </div>

        </div>
        <br class="clear" />
        <div class="content">
            
            <div class="display-label error">
                <div class="errorcontent">
                    <p><%= Html.ValidationMessage("Notice")%></p>
                    <p><%= Html.ValidationMessageFor(model => model.Title)%></p>
                    <p><%= Html.ValidationMessageFor(model => model.Description)%></p>
                    <p><%= Html.ValidationMessageFor(model => model.Content)%></p>
                </div>
            </div>
            
            <img src="../../../Image/Article/thumbnail/<%= Model.Photo %>" alt="<%=  Model.Photo %>" class="img_h170"/>
            <div>
            <% using (Html.BeginForm("Edit", "Article"))
               {%>
                <div class="editor_left">
                    <label>Ngôn ngữ của bài viết này :</label><br />
                    <%= Html.DropDownList("languageID", (SelectList)ViewData["LaguageList"], new { @style = "width:300px;", onchange = "this.form.submit();" })%>
                    <%= Html.HiddenFor(model => model.ArticleID)%>
                    <%= Html.HiddenFor(model => model.ArticleTypeID)%>
                </div>
            <%} %>

            <% using (Html.BeginForm("ArticleEdit", "Article", FormMethod.Post, new { enctype = "multipart/form-data" })){%>
            <%= Html.AntiForgeryToken(IntroduceCompany.Util.AntiKey.EditSalt)%>

                <div class="editor_middle">
                    <label>Đăng ảnh:</label><br />
                    <input name="uploadFile" id="File1" type="file" />
                </div>
            </div><br class="clear"/><br />
            <div>
                <div class="editor_left">
                    <label>Mã số bài viết:</label><br />
                    <%= Html.TextBoxFor(model => model.ArticleID, new { @readonly = "readonly" })%>
                </div>
                <div class="editor_middle">
                    <label>Loại bài viết:</label><br />
                    <%= Html.DropDownListFor(model => model.ArticleTypeID, ViewData["ArticleTypeList"] as SelectList, new { @style = "width:300px;" })%>
                </div>
            </div><br class="clear"/><br />
            <div>
                <div class="editor_left">
                    <label>Ngày chỉnh sửa cuối:</label>
                    <%= IntroduceCompany.Util.GeneralClass.ConvertDate_1B(Model.ArticleDate)%>
                </div>
                <div class="editor_middle">
                    <label>Người chỉnh sửa cuối:</label>
                    <%= Model.FullName%>
                </div>
            </div><br class="clear"/><br />
            <div>
                <label>Tiêu đề:</label><br />
                <%= Html.TextBoxFor(model => model.Title, new { @style = "width:620px;", maxlength = "500"  })%>
            </div><br class="clear"/><br />
            <div>
                <label>Mô tả : </label><br />
                <%= Html.TextAreaFor(model => model.Description)%>
            </div><br class="clear"/><br />
            <div>
                <label>Nội dung:</label><br />
                <%= Html.TextAreaFor(model => model.Content, new { @class = "ckeditor"})%>
            </div><br class="clear"/>
                <%= Html.HiddenFor(model => model.Photo) %>
                <%= Html.HiddenFor(model => model.LanguageID) %>
            <p>
                <input type="submit" value="Save" />
                <a href="<%= Url.Action("Edit", "Article", new { articleID = Model.ArticleID, languageID = Model.LanguageID, articleTypeID = Model.ArticleTypeID }) %>"  class="buttonform">Làm Lại</a>
            </p>
            <script type="text/javascript">
                CKEDITOR.replace('Content', {
                    BasePath: '../../../Content/Backend/js/ckeditor/',
                    customConfig: 'CustomAdmin.js'
                });
	        </script>
        <% } %>
        </div>
    </div>   
</asp:Content>

